﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DiscardDevice.aspx.cs" Inherits="H2.NET.Web.Pages.SMD.DiscardDevice" %>

<%@ Register Src="../../Controls/DwzAssessment.ascx" TagName="DwzAssessment" TagPrefix="uc" %>
<%@ Register Src="../../Controls/DwzAssessmentList.ascx" TagName="DwzAssessmentList" TagPrefix="uc" %>
<%@ Register Src="../../Controls/AjaxUpload.ascx" TagName="ajaxUpload" TagPrefix="uc" %>
<%@ Register Src="uc_store_info.ascx" TagName="uc_store_info" TagPrefix="uc" %>
<%@ Register Src="uc_head.ascx" TagName="uc_head" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
<head id="Head1" runat="server">
    <title>设备报废或库存</title>
    <link href="<%=Page.ResolveUrl("~/Resource/Css/Style.css")%>" type="text/css" rel="stylesheet" />
    <link href="<%=Page.ResolveUrl("~/Resource/jBox/Blue/jbox.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/Css/validform.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=Page.ResolveUrl("~/Resource/dwz/js/jquery-1.7.2.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Common.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/jquery.money.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-2.3.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-zh-CN.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Validform_v5.3.2.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/My97DatePicker/WdatePicker.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.js")%>" type="text/javascript"></script>
    <script type="text/javascript">
        var step = "<%=TaskAPI.Step.Trim()%>";
        $(function () {
            /* 初始化相关样式、表单验证提示 st */
            $("[datatype='*']").after("<em class='required'>*</em>");
            $("#form1").Validform({
                tipSweep: true,
                tiptype: function (msg, o, cssctl) {
                    if (o.type == 3) {
                        $.jBox.tip(msg, 'info');
                    }
                }
            });
            /* 初始化相关样式、表单验证提示 ed */
            // 双击选择门店之后跳转的url
            $("#return_url").val('<%=Page.ResolveUrl("~/pages/smd/DiscardDevice.aspx?TaskID=" + TaskAPI.TaskID)%>');


            /* 初始化控件提示 st */
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/ajaxtools/handler.ashx?action=get_tips")%>',
                data: { pagename: 'discarddevice.aspx' },
                dataType: "json",
                cache: false,
                success: function (json) {
                    for (var o in json) {
                        var ControlID = json[o].ControlID;
                        var Content = json[o].Content;
                        $("#" + ControlID).qtip({
                            content: Content
                        });
                    }
                }
            });
            /* 初始化控件提示 ed */

            if ("<%=TaskAPI.Step%>" != "Submit Data") {
                $("#device_list tr td:first,#device_list tr th:first").hide();
            }
            /*当选择寄存时候 隐藏下方保证金变更*/
            $("#rbl_status").on("click", "input[name='rbl_status']", function (i, item) {

                if ($($("input[name='rbl_status']").get(1)).is(":checked")) { $("#margin").hide(); } else { $("#margin").show(); }

            });
            if ($($("input[name='rbl_status']").get(1)).is(":checked")) { $("#margin").hide(); } else { $("#margin").show(); }

            //暂存转报废保证金系统打钩 2016-12-11
            var trs = $("#uc_store_info1_device_list").find(".htable").find("tr");
            for (var i = 1; i < trs.size() ; i++) {
                var Amount = trs.eq(i).find("td").eq(8).html();//机器保证金
                if (Amount != null && Amount != undefined && Amount != "" && Amount != 0) {   //一旦查到机器保证金有数据复选框就自动打钩
                    $("#cb_DepositConfiscated").attr("Checked", "Checked");
                    break;
                } else {
                    $("#cb_DepositConfiscated").attr("Checked", false);
                    continue;
                }
            }
        });

        /* 提交表单 st */
        function confirmSubmit() {
            var fj = $("#upload_tbody_file").html();
            var status = $(":radio[name='rbl_status']:checked").val();
            if ($.trim(fj) == "" && status == "报废") {
                $.jBox.tip('请上传附件！', '提示');
                return false;
            }
            if (window.confirm("确认要提交吗？")) {
                $.jBox.tip('正在处理，请稍等...', 'loading');
                return true;
            }
            return false;
        }
        /* 提交表单 ed */
    </script>
</head>
<body>
    <div class="flowpage">
        <form id="form1" runat="server">
            <!-- 标题 st -->
            <uc1:uc_head ID="uc_head1" runat="server" />
            <!-- 标题 ed -->
            <table class="formTable">
                <uc:uc_store_info ID="uc_store_info1" runat="server" />

                <tbody>
                    <tr>
                        <td class="title" colspan="6">设备的报废或转库存</td>
                    </tr>
                    <tr>
                        <th>选择设备：</th>
                        <td colspan="5">
                            <asp:DropDownList ID="ddl_devices" runat="server" datatype="*" nullmsg="请选择设备"
                                AutoPostBack="true" OnSelectedIndexChanged="ddl_devices_SelectedIndexChanged">
                                <asp:ListItem Text="==请选择==" Value=""></asp:ListItem>
                            </asp:DropDownList>
                            <asp:Literal ID="l_devices" runat="server"></asp:Literal>
                        </td>
                    </tr>
                    <tr>
                        <th>设备状态：</th>
                        <td colspan="5">
                            <asp:RadioButtonList ID="rbl_status" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                            </asp:RadioButtonList>
                            <asp:Literal ID="l_status" runat="server"></asp:Literal>
                        </td>
                    </tr>
                    <tr id="margin">
                        <th>保证金变更：</th>
                        <td colspan="5">
                            <asp:CheckBox ID="cb_DepositConfiscated"  runat="server" Text="若有设备保证金，需要点击“涉及保证金变更”"/>
                            <asp:Literal ID="l_DepositConfiscated" runat="server"></asp:Literal>
                        </td>
                    </tr>
                </tbody>

                <!-- 相关附件 st -->
                <tbody>
                    <tr>
                        <th>相关附件：</th>
                        <td colspan="5">
                            <uc:ajaxUpload ID="ajaxUpload1" runat="server" />
                        </td>
                    </tr>
                </tbody>
                <!-- 相关附件 ed -->

                <!-- 审批列表 st -->
                <tbody id="assessment" runat="server" visible="false">
                    <tr>
                        <td class="title" colspan="6">审批列表</td>
                    </tr>
                    <tr>
                        <td colspan="6">
                            <uc:DwzAssessmentList ID="DwzAssessmentList1" runat="server" />
                        </td>
                    </tr>
                </tbody>
                <!-- 审批列表 ed -->

                <!-- 审批意见 st -->
                <tbody>
                    <uc:DwzAssessment ID="DwzAssessment1" runat="server" />
                </tbody>
                <!-- 审批意见 ed -->
            </table>
            <!-- 门店主数据变更表单 ed -->

            <!-- 操作按钮 st -->
            <%  if (H2.NET.Common.AksRequest.GetString("showbtn") != "0")
                { %>
            <div style="margin: 5px; padding-bottom: 10px; text-align: center;">
                <asp:Button ID="btn_submit" runat="server" CssClass="u-btn" Text="提交(Submit)" OnClick="btn_submit_Click" OnClientClick="return confirmSubmit();" />
                <input type="button" class="u-btn u-btn-c4" value="关闭(Close)" onclick="custom_close()" />
                <asp:HyperLink ID="hl_ExportPdf" runat="server" Visible="false" Target="_blank" CssClass="u-btn u-btn-c3" Style="height: 28px; line-height: 28px; display: inline-block;">生成(PDF)</asp:HyperLink>
                <asp:Button ID="btn_print" runat="server" CssClass="u-btn u-btn-c2" Text="打印(Print)" OnClientClick="window.print()" Visible="false" />
            </div>
            <%  } %>
        </form>
    </div>
     <script type="text/javascript">
         //$(function () {
         //    alert("哈哈哈");
         //    //暂存转报废保证金系统打钩 2016-12-11
         //    var trs = $("#rpt_deivce_deposit").find("tr");
         //    alert("等等：" + trs.size())
         //    for (var i = 0; i < trs.size() ; i++) {
         //        var Amount = trs[i].eq(9).val();//机器保证金
         //        alert("Amount:" + Amount);
         //        if (Amount != null && Amount != undefined || Amount != "" || Amount != 0) {   //一旦查到机器保证金有数据复选框就自动打钩
         //            alert("jjjjjj:" + Amount);
         //            $("cb_DepositConfiscated").attr("Checked", true);
         //            break;
         //        } else {
         //            continue;
         //        }
         //    }
         //})

    </script>
</body>
   
